<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "lang://mail">

<xsl:stylesheet
	version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	
	<xsl:template match="response" mode="comments">
		<xsl:apply-templates select="object" />
		
		<h3 class="write_comment">
			<a href="javascript:void(0);" onclick="showCommentForm (0, 'message_reply', {@object-id}); return false;">&labelWriteReply;:</a>
		</h3>
		<div style="display:none;" id="new_comment_0" />
	</xsl:template>
	
	<xsl:template match="object[@type='message_reply']">
		<xsl:param name="userLogin" select="property[@name='user_login']/value" />
		<xsl:param name="userAvatar" select="property[@name='user_avatar']/value" />
		
		<a>
			<xsl:attribute name="name">
				<xsl:value-of select="concat ('comment', @id)" />
			</xsl:attribute>
		</a>
		<div class="comment_item">
			<div>
				<xsl:attribute name="style">
					<xsl:value-of select="concat ('padding-left: ', number(@comment-level) * 50, 'px')" />
				</xsl:attribute>
				<div class="comment_header">
					<div class="comment_userpic">
						<a href="{$baseURI}/user/{$userLogin}">
							<xsl:if test="$userAvatar = ''">
								<img src="{$baseURI}/images/default-avatar-small.png" alt="" />
							</xsl:if>
							<xsl:if test="$userAvatar != ''">
								<img src="{$baseURI}/thumb_24_24{$userAvatar}" alt="" />
							</xsl:if>
						</a>
					</div>
					
					<a class="username" href="{$baseURI}/user/{$userLogin}">
						<xsl:value-of select="property[@name='user_name']/value" />
					</a>
					<span class="date">
						<xsl:value-of select="property[@name='pubdate']/value" />
					</span>
				</div>
				<div class="comment_content">
					<xsl:value-of select="property[@name='text']/value" disable-output-escaping="yes" />
				</div>
				<div>
					<xsl:text>(</xsl:text>
					<a href="javascript:void(0);" onclick="showCommentForm ({@id}, 'message', {../@object-id}); return false;">&labelCommentReply;</a>
					<xsl:text>)</xsl:text>
				</div>
				<div style="display:none;" id="new_comment_{@id}" />
			</div>
		</div>
	</xsl:template>
	
</xsl:stylesheet>